<script src="vue.js"></script>

<div id="app">
    <prpet></prpet>
</div>

<template id="chaild1">
    <div>
        <button @click="send">发送</button>

        <input type="text" v-model="msg"/>
    </div>
</template>

<script>
    Vue.component('prpet',{
        data(){
            return{
                msg:''
            }
        },

        template:'<div><child @childfn="prpetfn"></child>'+
        "获取子组件的信息为：{{msg}}</div>",

        methods:{
            prpetfn(value){
                this.msg=value;
            }
        }
    });

Vue.component('child',{
    template:'#chaild1',
    data(){
        return{
            msg:''
        }
    },
    methods:{
        send(){
            this.$emit('childfn',this.msg)
        }
    }
})

var vue=new Vue({
    el:'#app',
})

</script>

<style>

</style>

